package Kolekcje;
import java.util.*;

public class TestPriorityQueue {
	public static void main(String[] args) {
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
		Random rnd = new Random();
		for(int i=0; i<10; i++){
			pq.offer(rnd.nextInt(i+10));
		}
		System.out.println(pq);
		
		List<Integer> l = Arrays.asList(25, 22, 20,18,14,9,3,1,1,2,3,9,14,18,21,23,25);
		pq=new PriorityQueue<Integer>(l);
		System.out.println(pq);
		pq=new PriorityQueue<Integer>(l.size(), Collections.reverseOrder());
		pq.addAll(l);
		System.out.println(pq);
		
		String s="Bez pracy nie ma kołaczy".toLowerCase();
		List<String> ls=Arrays.asList(s.split(""));
		PriorityQueue<String> spq = new PriorityQueue<String>(ls);
		System.out.println(spq);
		spq=new PriorityQueue<String>(ls.size(), Collections.reverseOrder());
		spq.addAll(ls);
		System.out.println(spq);
		
		Set<Character> set = new HashSet<Character>();
		for(char c: s.toCharArray()){
			set.add(c);
		}
		PriorityQueue<Character> pqc = new PriorityQueue<Character>(set);
		System.out.println(pqc);

	}

}
